package com.ht.api.call.func.impl.shop;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.ht.api.bean.AjaxResult;
import com.ht.api.bean.LoginBean;
import com.ht.api.call.func.IFunctionCall;
import com.ht.api.db.Db;
import com.ht.api.db.DbList;
import com.ht.api.db.Entity;

import java.util.HashMap;
import java.util.Map;

/**
 * 商城用户查询
 */
public class MallUserQueryFunctionCall implements IFunctionCall {

    @Override
    public String getName() {
        return "商城用户查询";
    }

    @Override
    public JSONObject execute(LoginBean me, JSONObject param, AjaxResult result) {
        DbList list = result.getRecords();

        for (Entity log : list) {
            String openid = log.getStr("openid");

            String sql = "select oneid,nickname,aliasname,avatar,gender from user_main where status = 0 and bitmap_contains(users, "+Math.abs(openid.hashCode())+")";

            Entity user = Db.findOne(me.getDataSource(), sql);
            log.set("mapper_oneid", user);
        }



        return null;
    }
}
